package blackstar.agent.security;

import java.util.HashSet;
import java.util.Set;

public class DefaultSecurityUser implements SecurityUser
{
	private String username;
	private String password;
	private Set<String> roles = new HashSet<String>();
	{
		roles.add("user");
	}

	public DefaultSecurityUser(String username, String password)
	{
		this.username = username;
		this.password = password;
	}
	
	public void addRole(String role)
	{
		this.roles.add(role);
	}
	
	public boolean isRole(String role)
	{
		return this.roles.contains(role);
	}

	public String getUsername()
	{
		return username;
	}

	public String getPassword()
	{
		return password;
	}

	public boolean authenticate(Object credentials)
	{
		return this.password.equals(credentials);
	}

	public String getName()
	{
		return this.username;
	}
}
